<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Syncme</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<script type="text/javascript" src="js/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<!-- inclusao do css -->

<style type="text/css">
textarea {  /* position is inherited */
    left: 0; 
    top: 0; 
    right: 0;
    bottom: 100px;  /* Actually the height of select and input */
    width: 100%;
}
html,body,#main { height:100%; }
#mainInput { height:90%; resize:none;}
</style>
</head>
<body>
<div class="well" id="login">
    
    <form id="target">
    <fieldset>
    <legend>User Login</legend>
    <label>E-mail</label>
    <input type="hidden" id="opt" name="opt" value="LOGIN">
    
    <input type="text" placeholder="email" class="required email" id="email" name="email">
    <label>Password</label>
    <input type="password" placeholder="password" id="password"  class="required" name="password">
    <div>
    <button type="submit" class="btn">Submit</button>
    </div>
    </fieldset>
    
    </form>
    
    <a href="signup.html">SIGN UP</a>
</div>


<script type="text/javascript">

var ScreenController = {
		module:"syncme",
		listener:"ProfileListener.php",
		
		init:function(){
	
			

		}
};

ScreenController.init();

$(function(){
	$( "#target" ).submit(function( event ) {
		
		var test = $("#target").valid();

		if(test){
		$.ajax({
			type:"POST",
			dataType:"json",
			url:ScreenController.module+"/"+ScreenController.listener,
			data:$('#target').serialize(), 
			success: function(response) {
				
				if(response.error!=0  && response.error!=undefined){
					alert(response.msgError);
					
				}else{
					window.location = "text.html";
			    }
			}
		});
		}
		
		event.preventDefault();
		});
});
	
</script>
</body>
</html>